package cn.gok.oop;

/**
 * @ClassName 构造函数
 * @Description TODO
 * @Author HP
 * @Date 10:33 2022/7/5
 * @Version 1.0
 **/
class Car{
    private int price ;
    private String name;

    @Override
    public String toString() {
        return "Car{" +
                "price=" + price +
                ", name='" + name + '\'' +
                '}';
    }

    public Car(int price, String name) {
        this.price = price;
        this.name = name;
    }
    public void show(){
        System.out.println(this.price+""+this.name);
    }
}
class A {
    private int x;

    A() {
        this.x = 100;
    }

    public A(int x) {
        this.x = x;
    }

    public void test() {
        int y = 0;
        y++;
        System.out.println("x=" + this.x + "y=" + y);
    }
}

public class 构造函数 {
    public static void main(String[] args) {
        A a;
        a = new A(100);
        a.test();
    }

}
